/**
 * 智慧小区管理系统 - 权限组件索引
 * @author Wu.Liang
 * @date 2024-01-01
 * @updated 2024-12-21 - 完善权限组件导出
 */

// 权限按钮组件
export { default as PermissionButton } from './PermissionButton.vue'

// 权限容器组件
export { default as PermissionContainer } from './PermissionContainer.vue'

// 数据权限过滤组件
export { default as DataScopeFilter } from './DataScopeFilter.vue'

// 权限指令
export * from '@/directives/permission'

// 权限工具函数
export * from '@/utils/permission'

// 权限组件插件
import type { App } from 'vue'
import PermissionButton from './PermissionButton.vue'
import PermissionContainer from './PermissionContainer.vue'
import DataScopeFilter from './DataScopeFilter.vue'
import { permission, role, dataScope, permissionGroup, ifPermission } from '@/directives/permission'

export const permissionComponents = {
    install(app: App) {
        // 注册权限组件
        app.component('PermissionButton', PermissionButton)
        app.component('PermissionContainer', PermissionContainer)
        app.component('DataScopeFilter', DataScopeFilter)

        // 注册权限指令
        app.directive('permission', permission)
        app.directive('auth', permission)
        app.directive('role', role)
        app.directive('data-scope', dataScope)
        app.directive('permission-group', permissionGroup)
        app.directive('if-permission', ifPermission)
    }
}

export default permissionComponents 